package com.xuecheng.task;

import cn.hutool.core.collection.SpliteratorUtil;
import cn.hutool.core.date.DateUtil;
import com.xuecheng.order.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Sober_wxy
 * @date 2022/7/28 17:48
 */
@Component
public class PaymentJob {
        @Autowired
        private OrdersService ordersService;

        @Scheduled(cron = "0/30 * * * * ?")
        public void handle() throws Exception {
                System.out.println("当前时间：" + DateUtil.now());
                try {
                        ordersService.getPayment();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
}
